package com.ukao.cashregister.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.mcxtzhang.commonadapter.rv.CommonAdapter;
import com.mcxtzhang.commonadapter.rv.ViewHolder;
import com.ukao.cashregister.R;
import com.ukao.cashregister.bean.AddressList;

import java.util.ArrayList;

/**
 * Created by ukaodev on 2017/6/14.
 */

public class AddressDialogAdapter extends CommonAdapter<AddressList> {



    public AddressDialogAdapter(Context context,ArrayList<AddressList> datas ) {
        super(context, datas, R.layout.adapter_address_dialog);
    }




    @Override
    public void convert(ViewHolder holder, AddressList item) {
        TextView mregionalDesc= holder.getView(R.id.regionalDesc);
        TextView mdetail= holder.getView(R.id.detail);
        ImageView checkIamge= holder.getView(R.id.check_iamge);
        mregionalDesc.setText(item.getPhone()+" "+item.getName());
        mdetail.setText(item.getRegionalDesc()+" "+item.getDetail());
       if (item.getDef()==1 ){
           holder.itemView.setBackgroundResource(R.drawable.adderss_check_bg);
           item.setCheck(true);
       }else{
           holder.itemView.setBackgroundResource(R.drawable.shape_glay_normal_bg);
       }
       if (item.isCheck()){
           holder.itemView.setBackgroundResource(R.drawable.adderss_check_bg);
           checkIamge.setBackgroundResource(R.drawable.check_box_check);
       }else{
           checkIamge.setBackgroundResource(R.drawable.check_box_normal);
           holder.itemView.setBackgroundResource(R.drawable.shape_glay_normal_bg);
       }

    }


}
